package com.xx.ch07.demo.demo09;

import com.xx.ch07.demo.demo01.SysUser1;
import com.xx.ch07.demo.demo02.SysUser;
import com.xx.ch07.demo.demo06.SysUserMapperImpl;
import com.xx.ch07.demo.demo08.SysUserService;
import org.apache.log4j.Logger;
import org.aspectj.lang.annotation.Before;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.List;


/**
 * @author 许欣
 * 时间：2022/4/18 10:59
 * 描述：
 */
public class SysUserTest {
    private Logger logger=Logger.getLogger(String.valueOf(SysUserTest.class));

    public void  setUp() throws Exception{
    }
    @Test
    public void testGetUserList(){
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        SysUserService userService= (SysUserService) context.getBean("sysUserService");
        List<SysUser1>user1s=new ArrayList<>();
        SysUser1 sysUser1=new SysUser1();
        sysUser1.setRealName("张");
        sysUser1.setRoleId(1);
        user1s=userService.getList(sysUser1);
        for (SysUser1 userResult:user1s){
            logger.debug("testGetUserList account:"+
                    userResult.getAccount()+"and realName:"+
                    userResult.getRealName()+"and roleId"+
                    userResult.getRoleId()+"and roleName"+
                    userResult.getRoleIdName()+"and address"+
                    userResult.getAddress());
        }
    }
}
